<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<!-- xmlns: sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4"-->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>登录页面</title>
    <!-- 引用header的 HTML 代码片段 -->
    <div th:replace="~{fragments/header :: header}">...</div>
    <style>
        html {
            overflow-y: scroll;
        }

        body {
            width: 100%;
            overflow-x: hidden;
        }

        .lyear-wrapper {
            position: relative;
            background-image: url("/images/login-bg-3.jpg");
        }

        .lyear-login {
            display: flex !important;
            min-height: 100vh;
            align-items: center !important;
            justify-content: center !important;
        }

        .lyear-login:after {
            content: '';
            min-height: inherit;
            font-size: 0;
        }

        .login-center {
            background-color: rgba(255, 255, 255, .075);
            min-width: 29.25rem;
            padding: 2.14286em 3.57143em;
            border-radius: 3px;
            margin: 2.85714em;
        }

        .login-header {
            margin-bottom: 1.5rem !important;
        }

        .login-center .has-feedback.feedback-left .form-control {
            padding-left: 38px;
            padding-right: 12px;
            background-color: rgba(255, 255, 255, .075);
            border-color: rgba(255, 255, 255, .075)
        }

        .login-center .has-feedback.feedback-left .form-control-feedback {
            left: 0;
            right: auto;
            width: 38px;
            height: 38px;
            line-height: 38px;
            z-index: 4;
            color: #dcdcdc;
        }

        .login-center .has-feedback.feedback-left.row .form-control-feedback {
            left: 15px;
        }

        .login-center .form-control::-webkit-input-placeholder {
            color: rgba(255, 255, 255, .8);
        }

        .login-center .form-control:-moz-placeholder {
            color: rgba(255, 255, 255, .8);
        }

        .login-center .form-control::-moz-placeholder {
            color: rgba(255, 255, 255, .8);
        }

        .login-center .form-control:-ms-input-placeholder {
            color: rgba(255, 255, 255, .8);
        }

        .login-center .custom-control-label::before {
            background: rgba(0, 0, 0, 0.3);
            border-color: rgba(0, 0, 0, 0.1);
        }

        .login-center .lyear-checkbox span::before {
            border-color: rgba(255, 255, 255, .075)
        }

    </style>
</head>

<body>
<div class="row lyear-wrapper" style="background-size: cover; margin-left:0px;margin-right:0px;">
    <div class="lyear-login">
        <div class="login-center">
            <div class="login-header text-center">
                <a th:href="@{/index.html}"> <img alt="light year admin" th:src="@{/images/logo-sidebar.png}"> </a>
            </div>
            <form th:action="@{/api/tologin}" method="GET">
                <div class="form-group has-feedback feedback-left">
                    <input type="text" placeholder="请输入您的用户名" class="form-control" name="name" id="username"/>
                    <span class="mdi mdi-account form-control-feedback" aria-hidden="true"></span>
                </div>
                <div class="form-group has-feedback feedback-left">
                    <input type="password" placeholder="请输入密码" class="form-control" id="password" name="password"/>
                    <span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
                </div>
                <div class="form-group has-feedback feedback-left row">
                    <!--验证码-->
                    <div class="col-xs-7">
                        <input type="text" name="captcha" class="form-control" placeholder="验证码">
                        <span class="mdi mdi-check-all form-control-feedback" aria-hidden="true"></span>
                    </div>
                    <div class="col-xs-5">
                         <img th:src="@{/images/captcha.png}" class="pull-right" id="verifyimg" style="cursor: pointer; height: 38px;width: 140px;"
                              onclick="javascript:getCode();" title="点击刷新" alt="captcha">
                    </div>
                </div>
                <div class="form-group">
                    <label class="lyear-checkbox checkbox-primary m-t-10 text-white">
                        <input type="checkbox"><span>5天内自动登录</span>
                    </label>
                </div>
                <div class="form-group">
                    <button class="btn btn-block btn-primary" type="submit" onclick="location.href='major.html'">立即登录
                    </button>
                </div>
            </form>
            <footer class="col-sm-12 text-center text-white">
                <!-- <p class="m-b-0">Copyright © 2020 <a href="http://lyear.itshubao.com">IT书包</a>. All right reserved</p>-->
            </footer>
        </div>
    </div>
</div>
<!-- 引用footer的 HTML 代码片段 -->
<div th:replace="~{fragments/footer :: footer}">...</div>
<script type="text/javascript">
    getCode();
    /**
     * 获取验证码
     * 将验证码写到login.html页面的id = verifyimg 的地方
     */
    function getCode() {
        document.getElementById("verifyimg").src = timestamp("/api/verifyCode");
    }
    //为url添加时间戳
    function timestamp(url) {
        const getTimestamp = new Date().getTime();
        if (url.indexOf("?") > -1) {
            url = url + "&timestamp=" + getTimestamp
        } else {
            url = url + "?timestamp=" + getTimestamp
        }
        return url;
    };
</script>
</body>
</html>